Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the various Alignment controls props handling #63696

Open
wants to merge 9 commits into
base: trunk
Choose a base branch
from

Conversation

dhananjaykuber
Copy link
Contributor

Fixes #63649

What?

This PR standardizes and improves the labels and descriptions for alignment controls across various blocks (Paragraph, Table, Group, and Media & Text) to enhance clarity and accessibility.

Why?

The current implementation has inconsistent and sometimes misleading labels and descriptions for alignment controls. This leads to confusion for users, especially those using screen readers. Standardizing these elements will improve the overall user experience and accessibility of the Gutenberg editor.

How?

  • Updated the AlignmentControl, BlockAlignmentUI, and BlockVerticalAlignmentUI components to accept and properly use label and description props.
  • Modified the usage of these components in Paragraph, Table, Group, and Media & Text blocks to provide more accurate and consistent labels and descriptions.
  • Ensured that all alignment controls have appropriate aria-describedby attributes.

Screenshots or screencast

Paragraph
Screenshot 2024-07-18 at 3 20 34 PM
Screenshot 2024-07-18 at 3 21 01 PM

Table
Screenshot 2024-07-18 at 3 21 17 PM
Screenshot 2024-07-18 at 3 21 31 PM

Group
Screenshot 2024-07-18 at 3 22 06 PM
Screenshot 2024-07-18 at 3 22 17 PM

Media & Text
Screenshot 2024-07-18 at 3 22 31 PM
Screenshot 2024-07-18 at 3 22 40 PM

Copy link

github-actions bot commented Jul 18, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: dhananjaykuber <dhananjaykuber@git.wordpress.org>
Co-authored-by: afercia <afercia@git.wordpress.org>
Co-authored-by: colorful-tones <colorful-tones@git.wordpress.org>
Co-authored-by: kevin940726 <kevin940726@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@dhananjaykuber
Copy link
Contributor Author

dhananjaykuber commented Jul 18, 2024

Writing/updating test cases.

@akasunil akasunil added [Type] Bug An existing feature does not function as intended [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Block editor /packages/block-editor labels Jul 18, 2024
@@ -456,6 +456,9 @@ function TableEdit( {
<BlockControls group="block">
<AlignmentControl
label={ __( 'Change column alignment' ) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd change this label to use a more consistent wording with the other labels. Something along the lines of 'Align columns content' would be clear enough to amke the description not necessary.

Copy link
Contributor

@afercia afercia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR!
From an accessibility perspective I like the idea of making all these controls consistent to:

  • Have a clear label that uses the same pattern.
  • Have the ability to provide an optional description.

To me, all the labels should start with the verb Align so that I would suggest to change the label of the table block.

I;d think that all the labels are clear enough, there's no need to provide a description which would be a littl eredundantl For example:

label: "Align block"
description: "Change block alignment"

The label is already clear enough. I'm not sure it needs a description.

The one for the table columns could be:

label: "Change column alignment"

and not need the description "Adjust the alignment of content within table columns".

I'd appreciate a review from @wordpress/gutenberg-core

@colorful-tones
Copy link
Member

@ndiego @kevin940726

WP 6.7 Beta 2 is tomorrow - it seems there has been little movement on this and I'm thinking we should punt it to 6.8. Thoughts?

@kevin940726
Copy link
Member

That makes sense to me 👍.

@dhananjaykuber
Copy link
Contributor Author

screen-capture.webm

@dhananjaykuber
Copy link
Contributor Author

Please check I have removed unnecessary description and just added clear labels for controls

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Block editor /packages/block-editor [Type] Bug An existing feature does not function as intended
Projects
Status: 🏈 Punted to 6.8
Development

Successfully merging this pull request may close these issues.

Improve the various Alignment controls props handling
5 participants